package com.lq.ecoldchain.util

import java.util.*

/*
*2018/12/26 0026  19:13
*function by lq
*/
object ContentUtils {

    /*判断性别*/
    @JvmStatic
    fun judgeSex(num: Int): String {
        return when (num) {
            1 -> "男"
            2 -> "女"
            else -> "保密"
        }
    }

    /*判断是否设置了支付密码*/
    @JvmStatic
    fun payPassword(isSet: Boolean): String {
        return if (isSet) {
            "设置支付密码"
        } else {
            "修改支付密码"
        }
    }

    @JvmStatic
    fun enterState(state: Int?): String {
        return when (state) {
            1 -> "审核中"
            2 -> "审核失败"
            3 -> "审核成功"
            else -> "未入驻"
        }
    }

    /*付款方式*/
    @JvmStatic
    fun payWay(num: Int): String {
        return when (num) {
            1 -> "在线支付"
            2 -> "到付"
            else -> "其他"
        }
    }

    /*是否绿通 肉勾 车尾板*/
    @JvmStatic
    fun carTypeJudge(type: Boolean?): String {
        return if (type == true) {
            "是"
        } else {
            "否"
        }
    }

    /*毫秒数转时间*/
    @JvmStatic
    fun long2Time(time: Long): String {
        val data = Date()
        data.time = time
        val calendar = Calendar.getInstance()
        calendar.time = data
        val month = calendar.get(Calendar.MONTH) + 1
        val day = calendar.get(Calendar.DAY_OF_MONTH)
        val trueMonth = if (month > 9) {
            "$month"
        } else {
            "0$month"
        }
        val trueDay = if (day > 9) {
            "$day"
        } else {
            "0$day"
        }
        return "${calendar.get(Calendar.YEAR)}-$trueMonth-$trueDay"
    }

    @JvmStatic
    fun isNormalType(num: Int): String {
        return if (num == 1) {
            "标准单"
        } else {
            "转介绍单"
        }
    }

    @JvmStatic
    fun orderTakingType(status: Int): String {
        return when (status) {
            0 -> "订单已取消"
            1 -> "接单中"
            2 -> "待装货"
            3 -> "待客服确认"
            4 -> "待付款"
            5 -> "待卸货"
            8 -> "待司机确认送达"
            7 -> "已完成"
            else -> ""
        }
    }


    @JvmStatic
    fun accountType(type: Int): String {
        return when (type) {
            1 -> "支付预约服务费"
            2 -> "冻结订单费用"
            3 -> "提现"
            4 -> "冻结保证金"
            5 -> "订单超时"
            6 -> "提现失败,退款"
            7 -> "充值"
            else -> "其他"
        }
    }


}